package com.aaa.ssm.service.impl;

import com.aaa.ssm.dao.HelpDao;
import com.aaa.ssm.entity.Help;
import com.aaa.ssm.service.HelpServer;
import com.aaa.ssm.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @ fileName:HelpServiceImpl
 * @ description:
 * @ createTime:2023/3/31 10:11
 * @ version:1.0.0
 */
@Service
public class HelpServiceImpl implements HelpServer {
    @Resource
    private HelpDao helpDao;

    @Override
    public PageInfo queryAll(Page<Help> help) {
        //使用PageHelper
        //设置分页页码 pageNo 和每页显示数量 pageSize
        PageHelper.startPage(help.getPageNo(), help.getPageSize());
        return new PageInfo(helpDao.queryAll(help.getData()));
    }

    @Override
    public int add(Help help) {
        return helpDao.add(help);
    }

    @Override
    public int update(Help help) {
        return helpDao.update(help);
    }

    @Override
    public int delete(String id) {
        return helpDao.delete(id);
    }
}
